//
//  JsonUtils.m
//  MeiRiCai
//
//  Created by qiuqk on 13-5-26.
//  Copyright (c) 2013年 MeiRiCai. All rights reserved.
//

#import "JsonUtils.h"

@implementation JsonUtils

+ (NSMutableArray *)ToWinningDetails:(NSMutableArray *)array;
{
    NSMutableArray *newAarray = [[NSMutableArray alloc] init];
    
    for(id obj in array)
    {
        //[newAarray addObject: [[MRCWinningDetail alloc] initWithMutableDictionary:obj]];
    }
    
    return newAarray;
}

+ (NSDate *) ParseDate:(NSString *)value
{
    NSString *pattern = @"Date\\((\\d+)\\+(\\d+)\\)";
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:nil];
    NSTextCheckingResult *result = [regex firstMatchInString:value options:NSMatchingReportProgress range:NSMakeRange(0, value.length)];
    if (nil == result)
    {
        return nil;
    }
    NSRange range = [result rangeAtIndex:1];
    double seconds = [[value substringWithRange:range] longLongValue] / 1000.0;
    NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:seconds];
    
    return date;
}

@end
